SYSTEM
Section: C Library Functions (3)
Index
Return to Main Contents
BSD mandoc
NAME
system
- pass a command to the shell
SYNOPSIS
Fd #include <stdlib.h>
Ft int
Fn system const char *string
DESCRIPTION
The
Fn system
function
hands the argument
Fa string
to the command interpreter
sh(1).
The calling process waits for the shell to finish executing the command,
ignoring
SIGINT
and
SIGQUIT
and blocking
SIGCHLD
If
Fa string
is a
NULL
pointer,
Fn system
will return non-zero.
Otherwise,
Fn system
returns the termination status of the shell in the format specified by
waitpid(3).
RETURN VALUES
If a child process cannot be created, or the termination status of
the shell cannot be obtained,
Fn system
returns -1 and sets
errno
to indicate the error.
If execution of the shell fails,
Fn system
returns the termination status for a program that terminates with a call of
Fn exit 127 .
SEE ALSO
sh(1),
execve(2),
popen(3),
waitpid(3),
STANDARDS
The
Fn system
function
conforms to
St -ansiC
and
St -1003.2-92 .
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- SEE ALSO
-
- STANDARDS
-
This document was created by
man2html,
using the manual pages.
Time: 16:28:56 GMT, April 18, 2022